package org.kfish.framework.util;

import java.io.File;
import java.io.IOException;

import org.apache.commons.io.FileUtils;
import org.kfish.framework.log.Log;
import org.kfish.framework.log.Log.LogType;

public class FileUtil {

	public static File createFile(String filePath){
		
		File file;		
		file = new File(filePath);	
		if(!file.getParentFile().exists()){
			try {
				FileUtils.forceMkdir(file.getParentFile());	
				if(file.exists()){
					file.delete();
				}
				file.createNewFile();
			} catch (IOException e) {
				Log.getLogger(LogType.DETAIL).error("create file failure",e);
				throw new RuntimeException(e);
			}
		}
		
		
		
		return file;
		
	}
}
